/**
 * 您也可以將所有相對應的方法專門組織在一個委託（delegate）物件中，而不是撰寫在Controller類別中，當請求來到時，將委託給這個物件來執行指定的方法，<br>
 * 您只要設定MultiActionController的 "delegate" 屬性參考至委託物件即可<br>
 */

package controller.action.delegate;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;

import com.e885.log.E885Logger;

/**
 * @author Eric.Kao(gau168.gau@msa.hinet.net)
 * @version 1.0
 * @company E885 Group
 * @copyright Copyright (c) 2001-2008
 */

public class Delegate
{
	private String viewPage;

	/**
	 * 當 action 的值為 list
	 * 
	 * @param request
	 * @param response
	 * @return
	 */
	public ModelAndView list( HttpServletRequest request, HttpServletResponse response )
	{
		E885Logger.testLog.debug( "execute method list()" );

		return new ModelAndView( getViewPage(), "executed", "list" );
	}

	/**
	 * 當 action 的值為 add
	 * 
	 * @param request
	 * @param response
	 * @return
	 */
	public ModelAndView add( HttpServletRequest request, HttpServletResponse response )
	{
		E885Logger.testLog.debug( "execute method add()" );

		return new ModelAndView( getViewPage(), "executed", "add" );
	}

	/**
	 * 當 action 的值為 delete
	 * 
	 * @param request
	 * @param response
	 * @return
	 */
	public ModelAndView delete( HttpServletRequest request, HttpServletResponse response )
	{
		E885Logger.testLog.debug( "execute method delete()" );

		return new ModelAndView( getViewPage(), "executed", "delete" );
	}

	/**
	 * @return the viewPage
	 */
	public String getViewPage()
	{
		return viewPage;
	}

	/**
	 * @param viewPage the viewPage to set
	 */
	public void setViewPage( String viewPage )
	{
		this.viewPage = viewPage;
	}
}
